﻿<UserControl x:Class="Noc.Pomodoro.Controls.AnalogClockControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d"
             d:DesignHeight="100" d:DesignWidth="100"
             x:Name="ControlRoot" Background="Transparent" SizeChanged="OnSizeChanged">

  <UserControl.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="../Styles/ApplicationStyles.xaml" />
      </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
  </UserControl.Resources>

  <Grid Height="100" Width="100">

    <Grid.LayoutTransform>
      <ScaleTransform ScaleX="1" ScaleY="1" />
    </Grid.LayoutTransform>

    <Image Source="/Pomodoro;component/Resources/Clock-Face-01.png" Stretch="Fill" />
    <Image x:Name="MinuteHand" Source="/Pomodoro;component/Resources/Clock-Hand-Large.png" Width="50" VerticalAlignment="Top" HorizontalAlignment="Left">
      <Image.RenderTransform>
        <TransformGroup>
          <TranslateTransform X="-16" Y="-2" />
          <RotateTransform Angle="{Binding Time, ElementName=ControlRoot, Converter={StaticResource TimeSpanToAngleConverter}, ConverterParameter={StaticResource AnalogTimePart_Second}}" />
          <TranslateTransform X="50" Y="50" />
        </TransformGroup>
      </Image.RenderTransform>
    </Image>

  </Grid>
</UserControl>